package com.caocaog.market.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.apache.ibatis.type.JdbcType;
import org.jeecg.common.aspect.annotation.Dict;
import org.jeecg.common.system.base.entity.groups.UpdateGroup;
import org.jeecg.common.handler.ListToStringHandler;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 轮播图管理
 *
 * @author chechen
 * @date 2021-12-28
 */
@Data
@TableName("mk_images_carousel_basic")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "mk_images_carousel_basic对象", description = "轮播图管理")
public class ImagesCarousel implements Serializable {
    private static final long serialVersionUID = 1L;

    @TableId(type = IdType.ASSIGN_ID)
    @NotBlank(message = "更新时，id不能为空", groups = {UpdateGroup.class})
    @ApiModelProperty(value = "ID")
    private String id;

    @ApiModelProperty(value = "创建人")
    private String createBy;

    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "创建时间")
    private Date createTime;

    @ApiModelProperty(value = "更新人")
    private String updateBy;

    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "更新时间")
    private Date updateTime;

    @TableField(update = "%s+1")
    @ApiModelProperty(value = "版本号", hidden = true)
    private Integer lockVersion;

    @Dict(dicCode = "mk_whether")
    @TableLogic
    @ApiModelProperty(value = "是否删除", hidden = true)
    private Integer delFlag;

    @ApiModelProperty(value = "轮播图类型")
    private Integer positionType;

    @ApiModelProperty(value = "名称")
    private String name;

    @Size(min = 1, max = 9)
    @TableField(jdbcType = JdbcType.VARCHAR, insertStrategy = FieldStrategy.NOT_NULL, typeHandler = ListToStringHandler.class)
    @ApiModelProperty(value = "轮播图地址集合")
    private List<String> imagesCarousel;

    @ApiModelProperty(value = "绑定商品")
    private String bindGoods;

    public void clearFields () {
        this.delFlag = null;
        this.createBy = null;
        this.createTime = null;
        this.updateBy = null;
        this.updateTime = null;
    }

}
